package com.et;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Servlet implementation class Serlet1
 */
public class Serlet1 extends HttpServlet {
	private static final long serialVersionUID = 1L;

	String defaultLogin = "visiteur";
	String defaultPassword = "visiteur" ;
	
    /**
     * Default constructor. 
     */
    public Serlet1() {
        // TODO Auto-generated constructor stub
    }
    
   	

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
				
		String login = request.getParameter("login");
			if (login == null)
				login = defaultLogin;
		String password = request.getParameter("password");
			if (password == null)
				password = defaultPassword;
		
			request.setAttribute("login", login);
			request.setAttribute("password", password);
			getServletContext().getRequestDispatcher("/index.jsp").forward(request, response);
			
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		 doGet(request, response);
	}

}
